<!DOCTYPE html>
<html th:lang="#{lang}">
<head>
    <title th:text="|#{search}-#{title}|"></title>
    <meta name="keywords" th:content="#{keywords}">
    <meta name="description" th:content="#{description}">
    <div th:replace="common/meta"></div>
</head>
<body>
<div th:replace="common/header-back:: header(#{search},${lang})"></div>

<div th:replace="common/cate:: cate(${cates})"></div>

<div class="content">
    <div class="serarch">
        <form class="flexbox" action="">
            <input class="flex1" id="keyword" value="" type="text">
            <input type="button" id="search_button" th:value="#{search.btn}">
        </form>
        <div class="hot_search">
            <h6 th:text="#{search.hot}">热门搜索</h6>
            <ul>
                <li th:each="comic:${random}">
                    <a th:href="|/search/${comic.title}|" th:text="${comic.title}">真真难为</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div th:replace="common/footer"></div>
</body>
<div th:replace="common/js"></div>
<script type="text/javascript">
    function search() {
        var keyword = $("#keyword").val();
        if (keyword.trim() === "") {
            return false;
        }
        location.href = "/search/" + keyword;
    }

    $("#search_button").on("click", function () {
        return search();
    });
    document.addEventListener('keydown', function (e) {
        if (e.key === 'Enter') {
            search();
            e.preventDefault();
            return false;
        }
    });
</script>
</html>